//app.js
const request = require("./utils/request.js");
App({
  request: request,
  onShow:function(){
    // wx.hideTabBar();
  },
  onLaunch: function(options) {
    // wx.hideTabBar()
    this.getSystemInfo();
    const { model, system, statusBarHeight } = wx.getSystemInfoSync();
    var headHeight;
    if (/iphone\s{0,}x/i.test(model)) {
      headHeight = 88;
    } else if (system.indexOf("Android") !== -1) {
      headHeight = 68;
    } else {
      headHeight = 64;
    }
    this.globalData.headerHeight = headHeight;
    this.globalData.statusBarHeight = statusBarHeight;
  },
  getSystemInfo: function () {
    let t = this;
    wx.getSystemInfo({
      success: function (res) {
        t.globalData.systemInfo = res;
      }
    });
  },
  editTabbar: function() {
    let tabbar = this.globalData.tabBar;
    let currentPages = getCurrentPages();
    let _this = currentPages[currentPages.length - 1];
    let pagePath = _this.route;
    (pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
    let page = pagePath.split('/')[4]
    for (let i in tabbar.list) {

      tabbar.list[i].selected = false;
      (tabbar.list[i].pagePath.split('/')[2] == page) && (tabbar.list[i].selected = true);
      console.log(tabbar.list[i].pagePath.split('/')[2])
      console.log(page)
    }
    _this.setData({
      tabbar: tabbar
    });
  },
  apiUrl: "https://www.kuaidi100.com",
  globalData: {
    parameter:null,
    systemInfo: null,
    userInfo: null,
    uniacid:'',
    headerHeight: 0,
    statusBarHeight: 0,
    tabBar: {
      "backgroundColor": "#ffffff",
      "color": "#979795",
      "selectedColor": "#1c1c1b",
      "list": [
        {
          "pagePath":  "../onlineMallData/onlineMallData",
          "text": "概况",
          "iconPath": "https://res.lexiangpingou.cn/images/826/2020/05/e3v99W9UaMs7v9YFOOY3xafcvwMF6U.png",
          "selectedIconPath": "https://res.lexiangpingou.cn/images/826/2020/05/yvsX3OR16BZ1v6Nx77AblwO576NPlb.png"
          },
          {
            "pagePath": "../orderForm/orderForm",
            "text": "订单",
            "iconPath": "https://res.lexiangpingou.cn/images/826/2020/05/VZ4YsI1h8zYI5qT1gw1HnUwQ1y8z8H.png",
            "selectedIconPath": "https://res.lexiangpingou.cn/images/826/2020/05/k1fK7Y23QLbQf52BPyuYbMuk2F7MHz.png"
            },
          {
            "pagePath": "../pickup/pickup",
            "text": "自提",
            "iconPath": "https://res.lexiangpingou.cn/images/826/2020/05/fr8WR7mYGMWnWN7py3pm99pmr98wPm.png",
            "selectedIconPath": "https://res.lexiangpingou.cn/images/826/2020/05/skwn17nMLZuo7Hw0W0N7wQNWI1ZUWl.png"
            },
          {
            "pagePath": "../User/User",
            "text": "用户",
            "iconPath": "https://res.lexiangpingou.cn/images/826/2020/05/OJm3GJZrURQwZ523ms8UVIQWgIuwUg.png",
            "selectedIconPath": "https://res.lexiangpingou.cn/images/826/2020/04/aaPpBv8S4G4iZP4LeEL9J7zplC9gGJ.png"
          }
      ]
     },
    // appid:'wxeaef65640a28d704',
    // huodiepath2: "https://cch.natappvip.cc/",
    // huodiepath: "https://cch.natappvip.cc/",
    // huodieimgpath:"https://res.lexiangpingou.cn/",
    // dev:'https://cch.natappvip.cc/applet/live.php',
    // huodiesoft:'https://dev.huodiesoft.com/web/index.php',
    // natappvipindex:'https://cch.natappvip.cc/app/index.php',
    // wsspath:"wss://dev.huodiesoft.com:7272",

    // appid:"wxeaef65640a28d704",
    //  huodiepath2: "https://dev.huodiesoft.com/",
    //  huodiepath: "https://dev.huodiesoft.com/",
    // huodieimgpath: "https://res.lexiangpingou.cn/",
    // dev: 'https://dev.huodiesoft.com/applet/live.php',
    // huodiesoft: 'https://dev.huodiesoft.com/web/index.php',
    // natappvipindex: 'https://dev.huodiesoft.com/app/index.php',
    // wsspath: "wss://dev.huodiesoft.com:7272",
    // posdev:'https://dev.huodiesoft.com/posdataapi.php',
    // bossdata:" https://dev.huodiesoft.com/bossdataapi.php"

    appid:"wx76f448d3dce6ae0b",
    huodiepath2: "https://a6.lexiangpingou.cn/",
    // huodiepath2: "https://www.lexiangpingou.cn/",
    huodiepath: "https://www.lexiangpingou.cn/",
    huodieimgpath: "https://res.lexiangpingou.cn/",
    dev: 'https://a6.lexiangpingou.cn/applet/live.php',
    // dev: 'https://www.lexiangpingou.cn/applet/live.php',
    huodiesoft: 'https://www.lexiangpingou.cn/web/index.php',
    natappvipindex: 'https://www.lexiangpingou.cn/app/index.php',
    wsspath:"wss://live.lexiangpingou.cn:7272",
    posdev:'https://www.lexiangpingou.cn/posdataapi.php'

  }
});